import { useEffect, useState } from 'react';
import { Tag } from 'antd';

export default function UserStatus({ status }) {
  const [text, setText] = useState('');
  const [color, setColor] = useState('');

  useEffect(() => {
    switch (status) {
      case '1':
        setText('启用');
        setColor('green');
        break;
      case '2':
        setText('临时封禁');
        setColor('red');
        break;
      case '3':
        setText('永久封禁');
        setColor('red');
        break;
      default:
        setText('未知');
        setColor('gray');
        break;
    }
  }, [status]);

  return <Tag color={color}>{text}</Tag>;
}
